dir=$(dirname $0)
cd $dir && cd ..

rm -rf cszg_chat
npm run build


cd ./cszg_chat

cp -rf ../lib ./
cp -rf ../config.json ./init.config.json

cp -rf ../.npmrc ./
cp -rf ../package.json ./
cp -rf ../.f2econfig.prod.js ./init.f2econfig.js
cp -rf ../sh/start.sh ./

npm install --production

buildTime=$(date "+%Y-%m-%d %H:%M:%S")
echo "BuildTime：${buildTime}" >> ./version
echo "creator：`git config user.name`" >> ./version
echo "email：`git config user.email`" >> ./version
echo "gitBranch：`git branch | awk '/\*/ { print $2; }'`" >> ./version
echo "commitId：`git rev-parse HEAD`" >> ./version
# rm -rf index.html
cd ..
tar -zcf ./cszg_chat.tar.gz ./cszg_chat
